package com.future.lock.me.order.entity.bean;

import android.text.TextUtils;

import com.future.lock.common.Constants;

/**
 * Created by yzh on 2017/12/17.
 */

public class OrderListInfoBean {
    // 订单状态 0待付款 1已付款(等待发货) 2已发货 3已完成 4退款中 5退款成功 10 已取消（不传则获取全部订单）
    public static final int ORDER_STATUS_NONE = -1;
    public static final int ORDER_STATUS_WAIT_TO_PAY = 0;
    public static final int ORDER_STATUS_PAIED = 1;
    public static final int ORDER_STATUS_WAIT_FOR_DELIVERY = 2;
    public static final int ORDER_STATUS_FINISHED = 3;
    public static final int ORDER_STATUS_WAIT_TO_REFUND = 4;
    public static final int ORDER_STATUS_REFUNDED = 5;
    public static final int ORDER_STATUS_CANCELED = 10;

    /**
     * order_id : 1
     * order_sn : TEST100202020
     * status : 0
     * order_amount : 100.00
     * pay_time : null
     * goods_id : 1
     * goods_name : 测试商品
     * head_img : http://www.baidu.com
     */

    private String order_id;
    private String order_sn;
    private int status;
    private float order_amount;
    private String pay_time;
    private String goods_id;
    private String goods_name;
    private String head_img;

    public String getOrder_id() { return order_id;}

    public void setOrder_id(String order_id) { this.order_id = order_id;}

    public String getOrder_sn() { return order_sn;}

    public void setOrder_sn(String order_sn) { this.order_sn = order_sn;}

    public int getStatus() { return status;}

    public String getStatusStr() {
        String statusStr = "";
        switch (status) {
            case ORDER_STATUS_WAIT_TO_PAY:
                statusStr = "待付款";
                break;
            case ORDER_STATUS_PAIED:
                statusStr = "待发货";
                break;
            case ORDER_STATUS_WAIT_FOR_DELIVERY:
                statusStr = "待收货";
                break;
            case ORDER_STATUS_FINISHED:
                statusStr = "已完成";
                break;
            case ORDER_STATUS_WAIT_TO_REFUND:
                statusStr = "退款审核中";
                break;
            case ORDER_STATUS_REFUNDED:
                statusStr = "退款成功";
                break;
            case ORDER_STATUS_CANCELED:
                statusStr = "已取消";
                break;
        }
        return statusStr;
    }

    public String getStatusOperateStr() {
        String statusStr = "";
        switch (status) {
            case ORDER_STATUS_WAIT_TO_PAY:
                statusStr = "立即支付";
                break;
            case ORDER_STATUS_WAIT_FOR_DELIVERY:
                statusStr = "确认收货";
                break;
            case ORDER_STATUS_PAIED:
            case ORDER_STATUS_FINISHED:
            case ORDER_STATUS_WAIT_TO_REFUND:
            case ORDER_STATUS_REFUNDED:
            case ORDER_STATUS_CANCELED:
                break;
        }
        return statusStr;
    }

    public int getStatusTextColor() {
        int statusColor = 0xff333333;
        switch (status) {
            case ORDER_STATUS_WAIT_TO_PAY:
                statusColor = 0xffF8B317;
                break;
            case ORDER_STATUS_PAIED:
            case ORDER_STATUS_WAIT_FOR_DELIVERY:
            case ORDER_STATUS_WAIT_TO_REFUND:
                statusColor = 0xff333333;
                break;
            case ORDER_STATUS_FINISHED:
            case ORDER_STATUS_REFUNDED:
            case ORDER_STATUS_CANCELED:
                statusColor = 0xff999999;
                break;
        }
        return statusColor;
    }

    public void setStatus(int status) { this.status = status;}

    public float getOrder_amount() { return order_amount;}

    public void setOrder_amount(float order_amount) { this.order_amount = order_amount;}

    public String getPay_time() { return pay_time;}

    public void setPay_time(String pay_time) { this.pay_time = pay_time;}

    public String getGoods_id() { return goods_id;}

    public void setGoods_id(String goods_id) { this.goods_id = goods_id;}

    public String getGoods_name() { return goods_name;}

    public void setGoods_name(String goods_name) { this.goods_name = goods_name;}

    public String getHead_img() {
        if (!TextUtils.isEmpty(head_img) && !head_img.startsWith("http")) {
            return Constants.BASE_URL + head_img;
        }
        return head_img;
    }

    public void setHead_img(String head_img) { this.head_img = head_img;}

    public boolean isWaitToPay() {
        return status == ORDER_STATUS_WAIT_TO_PAY;
    }

    public boolean isWaitForDelivery() {
        return status == ORDER_STATUS_WAIT_FOR_DELIVERY;
    }
}
